예제 #1
0
 public IOAuthClientFlow BeginOAuthFlow(IEntitySession session, Guid userId, string serverName, string scopes = null)
 {
     using (session.WithElevateRead()) {
         var acct = session.GetOAuthAccount(serverName);
         session.Context.ThrowIfNull(acct, ClientFaultCodes.ObjectNotFound, "serverName", "Account not registered for server {0}.", serverName);
         scopes = string.IsNullOrWhiteSpace(scopes) ? acct.Server.Scopes : scopes; //take all scopes
         var flow = acct.BeginOAuthFlow(userId, scopes);
         return(flow);
     }
 }