Skip to content

AccessToken

nov edited this page Jun 30, 2020 · 4 revisions

AppleID::AccessToken

3-legged Access Token

Apple has no APIs accessible using their 3-legged Access Token.

I hope they will release UserInfo API which returns email, name etc. in near future.

Once those APIs are released, I'll update this page.

2-legged Access Token

User Migration

To migrate an user from a team to another team, you can use UserMigrationInfo API.

# Obtain 2-legged Access Token w/ user.migration scope
access_token = client.access_token!(
  scope: 'user.migration'
)

# Obtain "transfer_sub" from old "sub" (run by sending team)
# ref.) https://developer.apple.com/documentation/sign_in_with_apple/transferring_your_apps_and_users_to_another_team
res1 = access_token.transfer_to!(
  sub: original_sub,
  target: target_team_id
)

# Exchange "transfer_sub" with new "sub" (run by recipient team)
# ref.) https://developer.apple.com/documentation/sign_in_with_apple/bringing_new_apps_and_users_into_your_team
res2 = access_token.transfer_from!(
  transfer_sub: res1[:transfer_sub]
)
Clone this wiki locally