Skip to content

Latest commit

 

History

History
49 lines (37 loc) · 1.1 KB

api-oauth.md

File metadata and controls

49 lines (37 loc) · 1.1 KB

pCloudSdk.oauth

  • This is the API Reference for the oauth export. For details how to use them see Oauth.
  • If you want to built yourself a custom Oauth flow see the pCloud's API Docs.

initOauthToken

initOauthToken({
  client_id: string,
  redirect_uri: string,
  response_type: "token" | "code",
  receiveToken: (token, locationid) => void
});

You can use following method for Oauth authenticate without redirect uri(see listfolder example):

initOauthPollToken

initOauthPollToken({
  client_id: string,
  receiveToken: () => void,
  onError:() => void
});

popup()

// inside redirect_uri window
<script>
  pCloudSdk.oauth.popup();
</script>

getTokenFromCode

getTokenFromCode(
  code: string,
  client_id: string,
  app_secret: string
): Promise<{ userid, access_token }>
  • code can be received either manually by the user via copy & paste (see oauth example) or by specifying response_type: "code" to initOauthToken.