Getting Login Issue for New User with CoSign SOAP API - cosign-api

I have created the new user on the CoSign server. I am getting the following response (User password expired) while logging using the ValidateCredentials method.
Array
(
[Success] =>
[ErrData] => Array
(
[Message] => User password expired.
[Module] => ValidateCredentials
[Code] => -36
[InnerCode] => -1878916637
)
)
Can anybody help?

This error means that the user’s password has expired, and you need to reset it

Related

How to do a Sign Up with OAuth (facebook, twitter, google)?

I use Laravel (5) as my php framework, it recently added a library for social authentication (facebook, google, twitter and github).
I've been wondering how would you do a Sign Up with OAuth, a login can easily be done by getting the user's email via OAuth, checking if it exists in your DB, and if it does, then log in that user. But how would you do the Sign Up?
Mathius - I've recently been working on a site doing something similar to what you've described and this is what has worked for me:
public function syncUserDetails($userData)
{
// First I check to see if there is a user in the DB
// with the oAuth email address
if ( $user = $this->user->where('email', $userData->email)->first() )
{
// If there is a user, I simply update their local info
// with what is on their oAuth account
$user->token = $userData->token;
$user->google_id = $userData->id;
$user->name = $userData->name;
$user->avatar = $userData->avatar;
$user->first_name = $userData->user['given_name'];
$user->last_name = $userData->user['family_name'];
$user->save();
return $user;
}
// Otherwise, if the user doesn't already exist,
// I create them in my local user's DB
return $this->user->firstOrCreate([
'email' => $userData->email,
'token' => $userData->token,
'google_id' => $userData->id,
'name' => $userData->name,
'avatar' => $userData->avatar,
'first_name' => $userData->user['given_name'],
'last_name' => $userData->user['family_name']
]);
}
This is what I'm using to log in a user. However, you could just as easily run this alongside your regular Laravel login method.

How do I pass in the 'hd' option for OpenID Connect (Oauth2 Login) using the Google Ruby API Client?

The "Using Oauth 2.0 for Login" doc lists the 'hosted domain' parameter as a valid authentication parameter, but using the Google API Client for Ruby linked at the bottom I don't see how to pass it along with my request. Anyone have an example?
OK, wasn't perfect, but I just passed it to the authorization_uri attribute on the authorization object like so
client = Google::APIClient.new
client.authorization.authorization_uri(:hd => 'my_domain')
I still had trouble updating the Addressable::URI object to save the change (kept getting a "comparison of Array with Array failed" error), but this was good enough for me to use.
I couldn't get it to work using the Google::APIClient but managed to get it working using the OAuth2::Client like this
SCOPES = [
'https://www.googleapis.com/auth/userinfo.email'
].join(' ')
client ||= OAuth2::Client.new(G_API_CLIENT, G_API_SECRET, {
:site => 'https://accounts.google.com',
:authorize_url => "/o/oauth2/auth",
:token_url => "/o/oauth2/token"
})
...
redirect client.auth_code.authorize_url(:redirect_uri => redirect_uri,:scope => SCOPES,:hd => 'yourdomain.com')

Google oAuth with service account for Google Coordinate

I use the following code to obtain the access token of Google oAuth2.
There is an issue that if I don't add a line to refresh the token with assertion it would return nothing.
Moreover, this refresh token won't work, because when I use this token to access Google Coordinate it returned the 500 Backend Error.
Please correct me.
<?
// codes for getting access token
require_once ('/libs/google-api/src/Google_Client.php');
define('OAUTH2_CLIENT_ID', "MyClientID.apps.googleusercontent.com");
define('SERVICE_ACCOUNT_NAME', "MyEmail#developer.gserviceaccount.com");
define('KEY_FILE', 'f3dc516e866bb9fd42f58f9675d2ed57502d4093-privatekey.p12');
define('EMAIL', 'myEmail');
$key = file_get_contents(KEY_FILE);
$client = new Google_Client();
$client->setApplicationName("test");
$auth=new Google_AssertionCredentials(
SERVICE_ACCOUNT_NAME,
array('https://www.googleapis.com/auth/coordinate'),
$key
);
$client->setClientId(OAUTH2_CLIENT_ID);
$client->setAssertionCredentials($auth);
if($client->getAuth()->isAccessTokenExpired()){
$client->getAuth()->refreshTokenWithAssertion(); // if I didn't add this line it would return nothing
}
$accessToken=$client->getAccessToken();
?>
<?
// Errors of access to Google Coordinate using refresh token
stdClass Object
(
[error] => stdClass Object
(
[errors] => Array
(
[0] => stdClass Object
(
[domain] => global
[reason] => backendError
[message] => Backend Error
)
)
[code] => 500
[message] => Backend Error
)
)
?>
<?
// The refresh token received
{
"access_token":"ya29.1.AADtN_U0EDt_5lGMWWbBSOJActF4qEmVwiQ6EyPpEzrHy_ZUoyw7HxYmsgo-sXt1qPzcce9r8hmbviCKB-zQZMAqiO9-4gWxepbsc5jR7ceSgRRR07QvIIYgFZFoFjYCdg",
"expires_in":3600,
"created":1394837729
}
?>
Since you're receiving an acfess_token it is very unlikely that the error is in the authorization steps. Moreover, the correct answer for any Google API to an invalid token is to supply HTTP error code 401. So it appears to me as if the error is in your usage of the Coordinate API.

Laravel 4, how to send different flash messages depending on users credentials and hidden input

I am trying to check the status of a users account when the user logs into the application with Laravel 4.1.
$attempt = Auth::attempt(array('email' => $input['email'], 'password' => $input['password'], 'active'
=> $input['active']), true);
if($attempt) return Redirect::route('photos.index');
return Redirect::back()->withInput()->with('message', 'Your email or password are incorrect.');
I am using a hidden input "active" to check whether a user account is still active or not. This works fine. However, if this check fails, the user gets to see the same flash message that is displayed when he enters wrong credentials. How could I send a second flash message that states to the user that his account is not active anymore even if he had entered correct credentials?
Any help would be much appreciated.
Thanks!
If the Auth::attempt() fails you can check with this if it succeeded without an active account.
$attempt = Auth::attempt(array('email' => $input['email'], 'password' => $input['password'], 'active'
=> $input['active']), true);
if($attempt) return Redirect::route('photos.index');
// Check if credentials are correct but the account is not active
if (Auth::validate(array('email' => $input['email'], 'password' => $input['password'])))
{
// Valid but not active
return Redirect::back()->withInput()->with('message', 'Account not active.');
}
return Redirect::back()->withInput()->with('message', 'Your email or password are incorrect.');

AWeberApi - could not get Subscribers email

I run this code
print_r($list->subscribers);
You can see at the result I pasted below that there is no subscriber name and email... I tried all the sample codes i could find in the web and all of them have the same result.
Now my question is, how to get the emails of all the subscribers aside from the code I used above?
[last_followup_sent_link] => https://api.aweber.com/1.0/accounts/6023076/lists/20746327/campaigns/f105556951
[city] =>
[http_etag] => "d6a652460dae642a0732ecf75003de4t05be96f66a1-7c14178a7fa0b2a2b7fb74be93ff058ac477ea43"
[ad_tracking] => my_web_form
[dma_code] =>
[last_followup_message_number_sent] => 1
[last_followup_sent_at] => 2011-11-17 04:52:19-05:00
[latitude] =>
[is_verified] => 1
[status] => subscribed
[area_code] =>
[unsubscribed_at] =>
[self_link] =>
[unsubscribe_method] =>
[resource_type_link] => https://api.aweber.com/1.0/#subscriber
[subscription_method] => signup form
[subscribed_at] => 2011-11-17 04:51:41-05:00
[region] =>
[longitude] =>
[verified_at] => 2011-11-17 04:52:19-05:00
[country] =>
The problem is that you did not grant access to subscriber info in your app. Choose Edit -> Permission Settings, put a check mark in the Request Subscriber Info box then choose save permission settings and then choose save. If done correctly, you should be back at the apps page and it will now be displaying the additional permissions.
You will have to reset the key/secret and then get a new Oauth token and secret as well. When that takes place and it asks for permission, you should see a box above the login credentials detailing the request for personal subscriber details. If you don't see it, something is wrong.
Once completed you should see all subscriber data including email address.