<blockquote>
<p>Hmm I'm surprised we are considering facebook provided emails as verified as I don't believe they are verified in any real sense - like most sites they will probably have verified it when the user signed up but that might have been years ago.</p>
</blockquote>
<p>The same is true for OSM emails. In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1096" class="issue-link js-issue-link" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/1096" data-id="119436791" data-error-text="Failed to load issue title" data-permission-text="Issue title is private">#1096</a> we found evidence that Facebook only provides verified emails, but if we take into account that all addresses become obsolete with time, then we should not treat anything to be verified, and even maybe ask users to re-verify their email addresess once a year.</p>
<blockquote>
<p>Can you give a detailed explanation of the flow that uses [<code>mapsme_token</code> provider], and why it needs to be a separate provider rather than piggybacking on the other one?</p>
</blockquote>
<p>The provider is included in <code>omniauth-mapsme</code> gem. After a successful authentication it replaces the <code>:provider</code> field with <code>mapsme</code>, imitating a sign-in with that provider. It is built after the <a href="https://github.com/SoapSeller/omniauth-facebook-access-token">omniauth-facebook-access-token</a>, which is also invisible to the target app.</p>
<p>Regular OAuth2 flow from the <code>mapsme</code> provider is:</p>
<ol>
<li>User goes to <code>%osm%/auth/mapsme</code></li>
<li>User is redirected to <code>https://passport.maps.me/oauth/authorize?...&state=399whatever99</code></li>
<li>User authorized against maps.me server, if not yet</li>
<li>User is redirected back to <code>%osm%/auth/mapsme/callback?code=...&state=399whatever99</code></li>
<li>Server sends a request to <code>passport.maps.me</code> with the given code and receives as access token</li>
<li>Server uses that token to query the provider for user id and email</li>
<li>User is redirected to a relevant page, or <code>%osm%/user/new</code>.</li>
</ol>
<p>Now, if we already have an access token, we would want to skip steps 2-5 and simply give the server the token. It is not bound to an application, so you can make requests even from a different country using the same token. Alas, we have no way of giving the token in that workflow: it has only intermediate steps.</p>
<p>The workflow with a prepared token is:</p>
<ol>
<li>User goes to <code>%osm%/auth/mapsme_token/callback?access_token=123whatever456</code></li>
<li>Server uses that token to query the provider for user id and email</li>
<li>User is redirected to a relevant page, or <code>%osm%/user/new</code>.</li>
</ol>
<p>In theory I could merge these two strategies into one, checking in <code>callback_phase</code> whether the <code>access_token</code> parameter is specified, but it would be harder than just to make two separate strategies.</p>
<p>With a mobile app, when signing in to OSM via a facebook, the following workflow would be used:</p>
<ol>
<li>Sign in to Facebook or Google using a Native SDK and get an fb_access_token</li>
<li>Use fb_access_token to sign in to passport.maps.me using a series of API calls, and get an access_token</li>
<li>Open a WebView for <code>https://www.openstreetmap.org/auth/mapsme_token/callback?access_token=...</code> and wait for it to return osm_access_token and osm_access_secret.</li>
</ol>
<p>This way a user won't have to type their password for anything, since WebView doesn't have cookies from a native sdk or from sessions in a web browsing app. And even if that was okay, Google will start <a href="https://www.theregister.co.uk/2016/08/23/google_to_block_web_views_from_using_its_oauth/">blocking OAuth requests</a> in a WebView starting this April.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1433#issuecomment-278684718">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABWnLXZQnTFBlwtQOsL8xzV-gOjWKZKqks5razexgaJpZM4L8Kyb">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABWnLSOkvOod_X_dtWNJTZce15qN4uUQks5razexgaJpZM4L8Kyb.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/openstreetmap/openstreetmap-website/pull/1433#issuecomment-278684718"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/openstreetmap/openstreetmap-website","title":"openstreetmap/openstreetmap-website","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/openstreetmap/openstreetmap-website"}},"updates":{"snippets":[{"icon":"PERSON","message":"@Zverik in #1433: \u003e Hmm I'm surprised we are considering facebook provided emails as verified as I don't believe they are verified in any real sense - like most sites they will probably have verified it when the user signed up but that might have been years ago.\r\n\r\nThe same is true for OSM emails. In #1096 we found evidence that Facebook only provides verified emails, but if we take into account that all addresses become obsolete with time, then we should not treat anything to be verified, and even maybe ask users to re-verify their email addresess once a year.\r\n\r\n\u003e Can you give a detailed explanation of the flow that uses [`mapsme_token` provider], and why it needs to be a separate provider rather than piggybacking on the other one?\r\n\r\nThe provider is included in `omniauth-mapsme` gem. After a successful authentication it replaces the `:provider` field with `mapsme`, imitating a sign-in with that provider. It is built after the [omniauth-facebook-access-token](https://github.com/SoapSeller/omniauth-facebook-access-token), which is also invisible to the target app.\r\n\r\nRegular OAuth2 flow from the `mapsme` provider is:\r\n1. User goes to `%osm%/auth/mapsme`\r\n2. User is redirected to `https://passport.maps.me/oauth/authorize?...\u0026state=399whatever99`\r\n3. User authorized against maps.me server, if not yet\r\n4. User is redirected back to `%osm%/auth/mapsme/callback?code=...\u0026state=399whatever99`\r\n5. Server sends a request to `passport.maps.me` with the given code and receives as access token\r\n6. Server uses that token to query the provider for user id and email\r\n7. User is redirected to a relevant page, or `%osm%/user/new`.\r\n\r\nNow, if we already have an access token, we would want to skip steps 2-5 and simply give the server the token. It is not bound to an application, so you can make requests even from a different country using the same token. Alas, we have no way of giving the token in that workflow: it has only intermediate steps.\r\n\r\nThe workflow with a prepared token is:\r\n\r\n1. User goes to `%osm%/auth/mapsme_token/callback?access_token=123whatever456`\r\n2. Server uses that token to query the provider for user id and email\r\n3. User is redirected to a relevant page, or `%osm%/user/new`.\r\n\r\nIn theory I could merge these two strategies into one, checking in `callback_phase` whether the `access_token` parameter is specified, but it would be harder than just to make two separate strategies.\r\n\r\nWith a mobile app, when signing in to OSM via a facebook, the following workflow would be used:\r\n\r\n1. Sign in to Facebook or Google using a Native SDK and get an fb_access_token\r\n2. Use fb_access_token to sign in to passport.maps.me using a series of API calls, and get an access_token\r\n3. Open a WebView for `https://www.openstreetmap.org/auth/mapsme_token/callback?access_token=...` and wait for it to return osm_access_token and osm_access_secret.\r\n\r\nThis way a user won't have to type their password for anything, since WebView doesn't have cookies from a native sdk or from sessions in a web browsing app. And even if that was okay, Google will start [blocking OAuth requests](https://www.theregister.co.uk/2016/08/23/google_to_block_web_views_from_using_its_oauth/) in a WebView starting this April."}],"action":{"name":"View Pull Request","url":"https://github.com/openstreetmap/openstreetmap-website/pull/1433#issuecomment-278684718"}}}</script>